Skip to content

Add vendor approval flow with VendorStatus enum#35

Merged
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
deslawson:core-implement-vendor-verification-and-approval-flow-#23
Jun 22, 2026
Merged

Add vendor approval flow with VendorStatus enum#35
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
deslawson:core-implement-vendor-verification-and-approval-flow-#23

Conversation

@deslawson

@deslawson deslawson commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Pull Request #23

Description

Replaced the active: bool field in VendorInfo with a VendorStatus enum (Pending, Approved, Suspended, Rejected). register_vendor() now sets new vendors to Pending instead of immediately active. Added admin-only approve_vendor() and suspend_vendor() functions. Updated is_active() to return true only for Approved vendors, which automatically gates loan creation in creditline-contract via its existing validate_vendor() call. Legacy functions (activate_vendor, deactivate_vendor, set_vendor_status) map to the new enum for backward compatibility. Updated all tests and creditline test helpers to register + approve vendors before creating loans.
Files touched: vendor-registry-contract/src/lib.rs, vendor-registry-contract/src/types.rs, vendor-registry-contract/src/events.rs, vendor-registry-contract/src/errors.rs, vendor-registry-contract/src/tests.rs, creditline-contract/src/tests.rs

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changes Made

Added VendorStatus enum (Pending, Approved, Suspended, Rejected) to types.rs

  • Replaced active: bool with status: VendorStatus in VendorInfo
  • register_vendor() now sets status = Pending instead of active = true
  • Added approve_vendor() — admin-only, requires Pending → Approved
  • Added suspend_vendor() — admin-only, sets Suspended
  • Updated is_active() to return true only when status == Approved
  • Updated legacy functions (activate_vendor, deactivate_vendor, set_vendor_status) to map to the new enum
  • Added VendorNotPending error variant
  • Updated publish_vendor_status event to emit VendorStatus instead of bool
  • Updated vendor-registry tests; added 7 new tests (approval, rejection, suspension, re-approve, reentrancy guards)
  • Updated creditline test helpers to approve vendors after registration

Testing

  • Tests pass locally
  • New tests added (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex code
  • Documentation updated
  • No new warnings generated

Closed #23

Replaced the active: bool field in VendorInfo with a VendorStatus enum (Pending, Approved, Suspended, Rejected). register_vendor() now sets new vendors to Pending instead of immediately active. Added admin-only approve_vendor() and suspend_vendor() functions. Updated is_active() to return true only for Approved vendors, which automatically gates loan creation in creditline-contract via its existing validate_vendor() call. Legacy functions (activate_vendor, deactivate_vendor, set_vendor_status) map to the new enum for backward compatibility. Updated all tests and creditline test helpers to register + approve vendors before creating loans.
Files touched: vendor-registry-contract/src/lib.rs, vendor-registry-contract/src/types.rs, vendor-registry-contract/src/events.rs, vendor-registry-contract/src/errors.rs, vendor-registry-contract/src/tests.rs, creditline-contract/src/tests.rs

Closed StepFi-app#23
@EmeditWeb EmeditWeb merged commit 8fb91f9 into StepFi-app:main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: implement vendor verification and approval flow

2 participants